
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 1993. -- Pku2947 Widget Factory -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>1993: Pku2947 Widget Factory</h2><span class=green>Time Limit: </span>3 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>64 MB<br><span class=green>Submit: </span>24&nbsp;&nbsp;<span class=green>Solved: </span>18<br>[<a href='submitpage.php?id=1993'>Submit</a>][<a href='problemstatus.php?id=1993'>Status</a>][<a href='bbs.php?id=1993'>Discuss</a>]</center><h2>Description</h2><div class=content><p><span style="font-size: medium">The widget factory produces several different kinds of widgets. Each widget is carefully built by a skilled widgeteer. The time required to build a widget depends on its type: the simple widgets need only 3 days, but the most complex ones may need as many as 9 days. The factory is currently in a state of complete chaos: recently, the factory has been bought by a new owner, and the new director has fired almost everyone. The new staff know almost nothing about building widgets, and it seems that no one remembers how many days are required to build each diofferent type of widget. This is very embarrassing when a client orders widgets and the factory cannot tell the client how many days are needed to produce the required goods. Fortunately, there are records that say for each widgeteer the date when he started working at the factory, the date when he was fired and what types of widgets he built. The problem is that the record does not say the exact date of starting and leaving the job, only the day of the week. Nevertheless, even this information might be helpful in certain cases: for example, if a widgeteer started working on a Tuesday, built a Type 41 widget, and was fired on a Friday,then we know that it takes 4 days to build a Type 41 widget. Your task is to figure out from these records (if possible) the number of days that are required to build the different types of widgets. </span></p>
<p></p>
<p><span style="font-size: medium">&nbsp; </span></p>
<div v:shape="_x0000_s1026"><span style="font-size: medium">制作n种小玩具需要3-9天的时间，现在有m批由不同的玩具组成的任务的历史记录，记录里是开始和结束分别是星期几。求出每个玩具的制作时间。</span></div></div><h2>Input</h2><div class=content><p>The input contains several blocks of test cases. Each case begins with a line containing two integers: the number 1 &le; n &le; 300 of the different types, and the number 1 &le; m &le; 300 of the records. This line is followed by a description of the m records. Each record is described by two lines. The first line contains the total number 1 &le; k &le; 10000 of widgets built by this widgeteer, followed by the day of week when he/she started working and the day of the week he/she was fired. The days of the week are given bythe strings `MON', `TUE', `WED', `THU', `FRI', `SAT' and `SUN'. The second line contains k integers separated by spaces. These numbers are between 1 and n , and they describe the diofferent types of widgets that the widgeteer built. For example, the following two lines mean that the widgeteer started working on a Wednesday, built a Type 13 widget, a Type 18 widget, a Type 1 widget, again a Type 13 widget,and was fired on a Sunday. 4 WED SUN 13 18 1 13 Note that the widgeteers work 7 days a week, and they were working on every day between their first and last day at the factory (if you like weekends and holidays, then do not become a widgeteer!). The input is terminated by a test case with n = m = 0 . 制作n种小玩具需要3-9天的时间，现在有m批由不同的玩具组成的任务的历史记录，记录里是开始和结束分别是星期几。求出每个玩具的制作时间。</p></div><h2>Output</h2><div class=content><p>For each test case, you have to output a single line containing n integers separated by spaces: the number of days required to build the different types of widgets. There should be no space before the first number or after the last number, and there should be exactly one space between two numbers. If there is more than one possible solution for the problem, then write `Multiple solutions.' (without the quotes). If you are sure that there is no solution consistent with the input, then write `Inconsistent data.'(without the quotes).</p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>2 3<br />
2 MON THU<br />
1 2<br />
3 MON FRI<br />
1 1 2<br />
3 MON SUN<br />
1 2 2<br />
10 2<br />
1 MON TUE <br />
3<br />
1 MON WED<br />
3<br />
0 0<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>8 3<br />
Inconsistent data.<br />
<br />
</span></div><h2>HINT</h2>
			<div class=content><p><p>Huge input file, 'scanf' recommended to avoid TLE.</p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Cerc2005'>Cerc2005</a></p></div><center>[<a href='submitpage.php?id=1993'>Submit</a>][<a href='problemstatus.php?id=1993'>Status</a>][<a href='bbs.php?id=1993'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
